<el-dialog class="dialogStyleBase" :title="mixinEdit_editTitle" width="900px" :visible.sync="mixinEdit_editVisible"
    :before-close="function(){mixinEdit_editBoxClose('editForm')}" append-to-body>
    <div class="dialogStyleBaseBox" v-loading="mixinEdit_loading">
        <el-form ref="editForm" :model="form" label-width="130px" label-position="left">
            <LayoutCell>
                <LayoutCellItem title="等级分红比例">
                    <el-form-item label="等级权重" prop="level_weight" :rules="{ required: true, message: '等级权重 不能为空'}">
                        <el-button class="level-style" 
                                  :class="{level: item == form.level_weight}" 
                                  v-for="item in levelList" 
                                  @click="addLevel(item, index)" 
                                  :disabled="form.level_weight == 0 || noLevel.includes(item)">
                                  {{item}}级
                         </el-button>
                    </el-form-item>
                    <el-form-item label="等级名称" prop="name" :rules="{ required: true, message: '等级名称 不能为空'}">
                        <el-input v-model="form.name"></el-input>
                    </el-form-item>
                    <el-form-item label="分红比例" prop="deduct_ratio" :rules="{ required: true, message: '分红比例 不能为空'}">
                        <el-input v-model="form.deduct_ratio"><template slot="append">%</template></el-input>
                        <div class="text">该等级队长按照此比例进行分红，最多支持4位小数点，即百万分之一</div>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="业绩奖励" v-if="form.level_weight != 0">
                    <el-form-item label="业绩奖励" prop="achievements">
                        <div v-for="(item,index) in form.achievements" style="margin-bottom: 10px; display: flex;align-items: center;">
                            <div class="left">
                                <el-input v-model="item.section">
                                    <template slot="prepend">团队业绩达到</template> <template slot="append">元</template>
                                </el-input>
                                <el-input v-model="item.award" style="padding: 12px 0;">
                                        <template slot="prepend">奖励</template><template slot="append">%</template>
                                </el-input>
                            </div>
                            <div class="right" style="padding: 0 12px;" >
                                <el-button class="el-icon-delete" @click="delAchievements(item, index)"></el-button>
                            </div>
                        </div>
                        <el-button @click="addAchievements()">添加区间</el-button>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="育人奖设置">
                    <el-form-item label="育人奖比例" prop="educate_ratio" :rules="{ required: true, message: '育人奖比例 不能为空'}">
                        <el-input v-model="form.educate_ratio"><template slot="append">%</template></el-input>
                        <div class="text">队长分到了队长奖励后，比此队长高级的（用户关系链上级）队长，获取（用户关系链上级）队长的育人奖比例*队长奖励金额 （PS：仅相邻队长可用）</div>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="超越奖设置">
                    <el-form-item label="超越奖比例" prop="transcend_ratio" :rules="{ required: true, message: '超越奖比例 不能为空'}">
                        <el-input v-model="form.transcend_ratio"><template slot="append">%</template></el-input>
                        <div class="text">队长分到了队长奖励后，比此队长低级的（用户关系链上级）队长，获取（用户关系链上级）队长的超越奖比例*队长奖励金额</div>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="感恩奖设置">
                    <el-form-item label="感恩奖" prop="grade_ratio" :rules="{ required: true, message: '感恩奖比例 不能为空'}">
                        <el-input v-model="form.grade_ratio"><template slot="append">元</template></el-input>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="平级奖设置">
                    <el-form-item label="平级奖比例" prop="equal_ratio" :rules="{ required: true, message: '平级奖比例 不能为空'}">
                        <el-input v-model="form.equal_ratio"><template slot="append">%</template></el-input>
                        <div class="text">队长分到了队长奖励后，与此队长平级的（用户关系链上级）队长，获取（用户关系链上级）队长的平级奖比例*队长奖励金额</div>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="等级说明">
                    <el-form-item label="等级说明" prop="level_describe_status" :rules="{ required: true, message: '等级说明 不能为空'}">
                        <el-radio-group v-model="form.level_describe_status">
                            <el-radio :label="1">开启</el-radio>
                            <el-radio :label="0">关闭</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item v-if="form.level_describe_status == 1" label="内容" prop="level_describe" :rules="{ required: true, message: '内容 不能为空'}">
                        <el-input v-model="form.level_describe"></el-input>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="添加升级条件" v-if="form.level_weight != 0">
                    <el-form-item label="升级方式" prop="upgrade_method" :rules="{ required: true, message: '升级方式 不能为空'}">
                        <el-radio-group v-model="form.upgrade_method">
                            <el-radio :label="0">满足以下任意条件</el-radio>
                            <el-radio :label="1">满足以下全部条件</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item>
                        <div class="condition-style" :class="{active : form.upgrade_show_array.includes(index)}" v-for="(item, index) in conditionList" @click="select(item, index)">{{ item }}</div>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="升级条件限制" v-if="form.level_weight != 0">
                    <el-form-item label="指定购买商品" prop="buy_specified_product" :rules="{ required: true, message: '指定购买商品 不能为空'}" v-if="form.upgrade_show_array.includes(0)">
                        <SelectDataGoods v-model="form.buy_specified_product" :appWindow="appWindow" :count="100" style="width: 80%;float: left;"
                            :apiConfig="$vFN.Tools.getAppGlobalData('componentsApiConfig.SelectDataGoods',appWindow)">
                        </SelectDataGoods><span class="del" @click="del(0, 'buy_specified_product')">删除</span>
                    </el-form-item>
                    <el-form-item label="自购订单总额" prop="self_order_amount" :rules="{ required: true, message: '自购订单总额 不能为空'}" v-if="form.upgrade_show_array.includes(1)">
                        <el-input style="width: 300px;" v-model="form.self_order_amount"><template slot="append">元</template></el-input><span class="del" @click="del(1, 'self_order_amount')">删除</span>
                    </el-form-item>
                    <el-form-item label="自购订单总数" prop="self_order_number" :rules="{ required: true, message: '自购订单总数 不能为空'}" v-if="form.upgrade_show_array.includes(2)">
                        <el-input style="width: 300px;" v-model="form.self_order_number"><template slot="append">个</template></el-input><span class="del" @click="del(2, 'self_order_number')">删除</span>
                    </el-form-item>
                    <el-form-item label="团队经销商人数" prop="team_dealer_number" :rules="{ required: true, message: '团队经销商人数 不能为空'}" v-if="form.upgrade_show_array.includes(3)">
                        <el-input style="width: 300px;" v-model="form.team_dealer_number"><template slot="append">人</template></el-input><span class="del" @click="del(3, 'team_dealer_number')">删除</span>
                    </el-form-item>
                    <el-form-item label="团队总人数" prop="team_member_number" :rules="{ required: true, message: '团队总人数 不能为空'}" v-if="form.upgrade_show_array.includes(4)">
                        <el-input style="width: 300px;" v-model="form.team_member_number"><template slot="append">人</template></el-input><span class="del" @click="del(4, 'team_member_number')">删除</span>
                    </el-form-item>
                    <el-form-item label="团队订单总数" prop="team_order_number" :rules="{ required: true, message: '团队订单总数 不能为空'}" v-if="form.upgrade_show_array.includes(5)">
                        <el-input style="width: 300px;" v-model="form.team_order_number"><template slot="append">个</template></el-input><span class="del" @click="del(5, 'team_order_number')">删除</span>
                    </el-form-item>
                    <el-form-item label="团队交易总额" prop="team_trade_amount" :rules="{ required: true, message: '团队交易总额 不能为空'}" v-if="form.upgrade_show_array.includes(6)">
                        <el-input style="width: 300px;" v-model="form.team_trade_amount"><template slot="append">元</template></el-input><span class="del" @click="del(6, 'team_trade_amount')">删除</span>
                    </el-form-item>
                    <el-form-item label="提现总额" prop="withdraw_amount" :rules="{ required: true, message: '提现总额 不能为空'}" v-if="form.upgrade_show_array.includes(7)">
                        <el-input style="width: 300px;" v-model="form.withdraw_amount"><template slot="append">元</template></el-input><span class="del" @click="del(7, 'withdraw_amount')">删除</span>
                    </el-form-item>
                </LayoutCellItem>
            </LayoutCell>
        </el-form>
    </div>
    <div slot="footer">
        <el-row>
            <el-col :span="12" style="text-align: left;">
                <el-button :disabled="mixinEdit_loading" @click="mixinEdit_resetForm('editForm')">重 置</el-button>
            </el-col>
            <el-col :span="12">
                <el-button :disabled="mixinEdit_loading" @click="mixinEdit_editBoxClose('editForm')">取 消</el-button>
                <el-button :disabled="mixinEdit_loading" type="primary"
                    @click="mixinEdit_editFormSubmit({model:'form',ref:'editForm'})">确
                    定</el-button>
            </el-col>
        </el-row>
    </div>
</el-dialog>